package mz.mobileservices.bim;

import mz.mobileservices.uem.R;
import mz.mobileservices.uem.SendSMS;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class AlterarPin extends Activity
{	
	Button btnSendSMS, btnCancel;
	EditText txtPinNovo, txtPinNo;

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.alterar_pin);
        
        btnSendSMS = (Button) findViewById(R.id.btnSendSMS);
        btnCancel = (Button) findViewById(R.id.btnCancel);
        txtPinNovo = (EditText) findViewById(R.id.txtPinNovo);
        txtPinNo = (EditText) findViewById(R.id.txtPinNo);

        btnCancel.setOnClickListener (new View.OnClickListener() 
        {	
			public void onClick(View v) 
			{
				finish();	
			}
		});
        
        btnSendSMS.setOnClickListener(new View.OnClickListener() 
        {
            public void onClick(View v) 
            {               
            	String pinNovo = txtPinNovo.getText().toString();
                String pinNo =  txtPinNo.getText().toString();
                                      
                if (pinNo.length()==0)
                {
                	Toast.makeText(getBaseContext(), "Por favor insera o PIN actual.", Toast.LENGTH_SHORT).show(); 
                }
                
                else
                  if (pinNovo.length()==0)
                    {
                    	Toast.makeText(getBaseContext(), "Por favor insera o novo PIN.",Toast.LENGTH_SHORT).show(); 
                    }	
                    else	
                    {
                	  String message = "BIM P"+" "+pinNovo+" "+pinNo;                	    
              		  Intent i = new Intent(getApplicationContext(),SendSMS.class);
              		  i.putExtra("numero","822424");
              		  i.putExtra("comando",message);
              		  
              		  startActivity(i);
              		  finish();
                    }
            }
        });        
    }
}